package com.qiaofang.common.utils;

import com.google.common.collect.Maps;

import java.util.concurrent.ConcurrentMap;

/**
 * 缓存用户信息
 */
public class TokenUtil {

    private static ConcurrentMap<Object, Object> tokenMap;

    static {
        tokenMap = Maps.newConcurrentMap();
    }

    public static void addToken(String key, Token value) {
        tokenMap.put(key, value);
    }

    public static Object getToken(String key) {
        if (StringUtil.isNotBlank(key)) {
            if (tokenMap.containsKey(key)) {
                return tokenMap.get(key);
            }
        }
        return null;
    }

}
